from django.db import models


# Create your models here.
# student:学号 姓名 性别 出生日期 手机号 邮箱 住址 照片

class Student(models.Model):
    gender_choices = ((1, 'Male'), (2, 'Female'))
    sno = models.CharField(db_column="SNo", max_length=12, null=False)
    name = models.CharField(db_column="SName", max_length=100, null=False)
    birth_date = models.DateField(db_column="Gender", null=False)
    mobile_no = models.CharField(db_column="Mobile", max_length=12, null=False)
    address = models.CharField(db_column="Address", max_length=100, null=False)
    age = models.IntegerField(db_column="Age", null=False)
    image = models.ImageField(db_column="Image", max_length=100, null=False)


# 默认生成表明app_class 自定义使用class meta
class Meta:
    managed = True
    db_table = 'Student'

    def __str__(self):
        return "学号：%s\t姓名：%s\t性别：%s\t" % (self.sno, self.name, self.gender)
# str方法返回学生信息
